#!/bin/bash
PROJECT="doctor"
VERSION="0.0.1-SNAPSHOT"
BAK_DIR=/home/jenkins/bak/$PROJECT/`date +%Y%m%d`
WORKSPACE=/home/jenkins/workspace

mkdir -p "${BAK_DIR}"
cp ${WORKSPACE}/${PROJECT}/target/"${PROJECT}-${VERSION}".jar "${BAK_DIR}"/"${PROJECT}"_`date +%Y%m%d%H%M%S`.jar

ps axu |grep -v 'grep' |egrep "doctor"|awk '{system("kill -9 "$2)}'

nohup java -Xms256m -Xmx512m -jar ${WORKSPACE}/${PROJECT}/target/"${PROJECT}-${VERSION}".jar &